package fragment;

import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.jizhangben.HomeActivity;
import com.example.jizhangben.R;
import com.example.jizhangben.databinding.FragmentWeixinBinding;
import com.example.jizhangben.databinding.FragmentZhiChuBinding;

import java.text.SimpleDateFormat;
import java.util.Date;


public class WeiXinFragment extends Fragment {
private FragmentWeixinBinding binding;

private HomeActivity activity;

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        activity = (HomeActivity)view.getContext();
        SharedPreferences sp = activity.getSharedPreferences("xinxi", Context.MODE_PRIVATE);


        ZhiChuFragment zhiChuFragment = new ZhiChuFragment();
        ShouRuFragment shouRuFragment = new ShouRuFragment();
        activity.getSupportFragmentManager().beginTransaction().add(R.id.fragment02,zhiChuFragment).commitAllowingStateLoss();
        binding.zhichu.setOnClickListener(v -> {
            activity.getSupportFragmentManager().beginTransaction().replace(R.id.fragment02,zhiChuFragment).commitAllowingStateLoss();
        });

        binding.shouru.setOnClickListener(v -> {
            activity.getSupportFragmentManager().beginTransaction().replace(R.id.fragment02, shouRuFragment).commitAllowingStateLoss();
        });



    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        binding = FragmentWeixinBinding.inflate(inflater, container, false);
        return binding.getRoot();
    }



}